<!DOCTYPE html>
<html>
<head>
    <title>推荐系列</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/strategyCatalogs.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .body{
            width: 100%;
        }
        .search-head{
            width: 100%;
        }
        .box img{
            width: 95%;
            overflow: hidden;
        }
        .tab-content{
            width: 100%;
        }
        .commend img{
            width: 95%;
            overflow: hidden;
        }
        .nav-search{
            padding: 0;
            width: 100%;
        }
        .operation{
            width: 100%;
        }
    </style>


    <script>
        $(function () {
            var icdId = getParams().id;
            //console.log(icdId);
            if(icdId){
                $.get('/landmarkContentDetail/'+icdId+"/title",function (data) {
                    //console.log(data);
                    $('.commend').renderValues(data)
                });


            }

            if(icdId){
                // 解决上一页数据丢失问题
                var dataList = [];
                //分页数据
                var currentPage = 1;
                // 限制滑动无限加载数据
                var totalPage = 1;
                function query() {
                    $.get('/landmarkContentDetail/'+icdId+"/all", {currentPage: currentPage}, function (data) {
                        dataList = $.merge(dataList, data.list);
                        $('.strategyCommend').renderValues({list: dataList}, {
                            // 拼接id到超链接
                            setHref: function (item, value) {
                                var href = $(item).data('href') + value;
                                $(item).attr('href', href);
                            }
                        });
                        currentPage += 1;
                        totalPage = data.pages;
                    });
                }
                query();
                //屏幕滚动事件
                $(window).scroll(function () {
                    // html 页面的高度
                    // 设备屏幕的高度
                    // 滑动的高度
                    // 达到底部时翻页
                    if ($(window).height() + $(document).scrollTop() + 1 >= $(document).height()) {
                        // 解决底部翻页问题
                        if (currentPage <= totalPage) {
                            query();
                        } else {
                            $(document).dialog({
                                type: 'notice',
                                infoText: '深不见底还是到底啦~',
                                autoClose: 2500,
                                position: 'bottom'  // center: 居中; bottom: 底部
                            });
                        }
                    }
                });
            }
        })
    </script>
</head>
<body>
<div class="body">
    <div class="search-head">
        <div class="row nav-search">
            <div class="col-2">
                <a href="javascript:history.go(-1);">
                    <span><i class="fa fa-chevron-left fa-2x"></i></span>
                </a>
            </div>
            <div class="col-10">
                <div class="input-group-sm search">
                    <input class="form-control searchBtn" placeholder="搜索推荐景点">
                </div>
            </div>
        </div>
    </div>
    <hr>
    <div class="tab-content" id="pills-tabContent">
        <div class="tab-pane fade active show" id="pills-top">
            <div class="container commend">
                <a>
                    <p render-html="lmTicketCatalogBig.name"></p>
                    <img id="img" render-src="coverUrl">
                </a>
            </div>
            <hr>
            <div class="container strategyCommend">
                <h6>景点票价</h6>
                <hr/>
                <div class="row hot" render-loop="list">
                    <div class="box">
                        <div>
                            <a data-href="landmarkContent.html?id=" render-fun="setHref" render-key="list.id">
                                <img render-src="list.coverURL" style="width: 50%">
                            </a>
                        </div>
                        <div>
                            <a data-href="landmarkContent.html?id=" render-fun="setHref" render-key="list.id">
                                <p render-html="list.title"></p>
                            </a>
                        </div>
                        <hr>
                    </div>

                </div>
            </div>
        </div>

    </div>
    <div class="operation">
        <button class="btn">加入旅行单</button>
        <button class="btn" id="commentBtn">点评</button>
    </div>
</div>
</body>
</html>